<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false"%>
<head>
<head>
<link href="${pageContext.request.contextPath}/system/page.css"
	rel="stylesheet" />
</head>

<script type="text/javascript">
	function gotoPage(pageNo) {
		$("#pageNo").val(pageNo);
		$("#pageForm").submit();
	}

	function deleteOne(id) {
		if (id == "" || id == null) {
			return;
		}
		art
				.dialog({
					content : '删除后不可恢复,请确认操作',
					// okVal:'确认删除',
					lock : true,
					ok : function() {
						$("#pageForm")
								.attr("action",
										"${pageContext.request.contextPath}/system/sysRoleDelete.do");
						$("#pageForm #id").val(id);
						$("#pageForm").submit();
						this.title('1秒后自动关闭').time(1);
						return false;
					},
					cancelVal : '关闭',
					cancel : true
				//为true等价于function(){}

				});
	}
	function view(id) {
		if (id == "" || id == null) {
			return;
		}
		$("#pageForm").attr("action",
				"${pageContext.request.contextPath}/system/sysRoleView.do");
		$("#pageForm #id").val(id);
		$("#pageForm").submit();
	}
	function edit(id) {
		if (id == "" || id == null) {
			return;
		}
		$("#pageForm").attr("action",
				"${pageContext.request.contextPath}/system/sysRoleEdit.do");
		$("#pageForm #id").val(id);
		$("#pageForm").submit();
	}

	function gotoPageChangePageSize(value) {
		$("#pageForm #pageSize").val(value);
		$("#pageForm").submit();
	}
	function sysRoleRight(value) {
		$("#pageForm")
				.attr("action",
						"${pageContext.request.contextPath}/system/sysRoleRightList.do");
		$("#pageForm #id").val(value);
		$("#pageForm").submit();
	}
</script>
<form id="pageForm" method="post"
	action="${pageContext.request.contextPath}/system/sysRoleList.do"
	onsubmit="return navTabSearch(this);">
	<input type="hidden" id="pageSize" name="page.pageSize"
		value="${page.pageSize}" /> <input type="hidden" id="pageNo"
		name="page.pageNo" value="${page.pageNo}" /> <input type="hidden"
		name="orderField" id="orderField" value="${orderField}" /> <input
		type="hidden" name="id" id="id" value="" /> <input type="hidden"
		name="queryStr" id="queryStr" value="${queryStr}" /> <input
		type="hidden" name="backUrl" id="backUrl" value="${backUrl}" />
</form>

<div class="formBar">
	<ul style="float: left;">
		<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
		<li><div class="buttonActive">
				<div class="buttonContent">
					<button type="button" onClick="return add();">添加</button>
				</div>
			</div></li>
		<li>
			<div class="button">
				<div class="buttonContent">
					<button type="button" onClick="return back();">取消</button>
				</div>
			</div>
		</li>
	</ul>
</div>
<div
	style=" float:left; display:block; margin:10px; overflow:auto; width:100%; height:100%; overflow:auto; border:solid 1px #CCC; line-height:21px; background:#FFF;">
	<p>treeFolder expand</p>
	<form method="post"
		action="${pageContext.request.contextPath}/system/sysRoleRightList.do"
		class="pageForm required-validate"
		onsubmit="return navTabSearch(this)">
		<input type="hidden" name="id" value="${id }" />
		<ul class="tree  treeCheck expand" oncheck="kkk">
			<s:iterator value="datas" status="right" id="right">
				<li><a href="javascript:void(0);">${rightname } </a>
					<ul>
						<s:iterator value="childList" status="status" id="child">
							<li><a tvalue="${rightid}"> ${rightname} ${flag2} <c:if
										test="#flag2 eq 'a'">
								 checked="true" 
								</c:if></a></li>
						</s:iterator>
					</ul></li>
			</s:iterator>


		</ul>

		<input type="button" onclick="return chekSubmit();" value="Submit" />
	</form>
</div>

<script type="text/javascript">
	function kkk2() {
		var json = arguments[0], result = "";
		//	alert(json.checked);
		$(".tree .ckbox").each(function(i) {
			//result += "<p>name:" + this.name + " value:" + this.value
			//		+ " text: " + this.text + "</p>";
			//result+="-"+this.value;
			//alert($("input:checked").val());
		});
		//$("#resultBox").html(result);
		//alert(result);/]
	}
	function kkk() {
		var firstlist = ""; // 第一级选中项集合，以逗号相隔。
		var secondlist = ""; //第二级选中项集合集合。
		//jquery循环tt下的所有选中的复选框
		$('input:checkbox[name="name"]:checked').each(function(i, a) {
			// alert(a.value); //alert(a.name);
			if (a.name == "name") {
				firstlist += a.value + ",";
			}
			/*  else if (a.name == "second") {
			   secondlist += a.value + ",";
			 } */
		});
		alert(firstlist);
		alert(secondlist);
		//$("#resultBox").html(firstlist.substring(0,firstlist.length-1));
		//$("#Chosesecond").val(secondlist .substring(0, secondlist .length - 1));
	}
	function back() {
		$("#pageForm").attr("action",
				"${pageContext.request.contextPath}/system/sysRoleList.do");
		$("#pageForm").submit();
	}
	function chekSubmit() {
		var result = "";
		$("input:checked").each(function(i) {
			//result += "<p>name:" + this.name + " value:" + this.value
			//		+ " text: " + this.text + "</p>";
			//result+="-"+this.value;
			//alert($("input:checked").val());
			result += i.val();
		});
		alert(result);
		return false;
	}

	
</script>